import re


class Subject:
    """
        被试基类
        fullName: 被试文件夹名称
    """
    def __init__(self, fullname, filepath=None):
        self.fullName = fullname
        self.filePath = filepath


class HLSubject(Subject):
    """
        老年性聋类
        name: 被试姓名
        number: 被试编号
    """

    def __init__(self, fullname, filepath=None):
        super().__init__(fullname, filepath)
        name, number = self.analysisFullName()
        self.name = name
        self.number = number

    def analysisFullName(self):
        ret = re.match(r"(\d+)(\D+).*", self.fullName)
        number = int(ret.group(1))
        name = ret.group(2)
        return name, number


if __name__ == "__main__":
    HL1 = HLSubject("207HUAXUEYUN")
    print(HL1.name)
    print(HL1.number)
